<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var num = 0
    for (var index = 0; index < 100; index = index + 2) {
        num = parseInt(num + index);
        if (num > 2000) {
            break;
        }
    }
    document.write(num);

    document.write('<br />');

    var num01 = 0,
        i = 0
    while (i < 100) {
        num01 = num01 + i;
        if (num01 > 2000) {
            break;
        }
        i = i + 2;
    }
    document.write(num01)
</script>

</html>